package com.cyou.qb.constants;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * 存放cache key 常量
 * @author luzhaoman
 *
 */
public class CacheKeyConstants {
	
	//规则model__name
	
	//定义各类domain
	//活动
	public final static String DOMAIN_ACTIVE="ACTIVE";
	//每个活动的抽奖次数
	public final static String DOMAIN_USER_DRAW_TRACE_ACTIVE="USER_DRAW_TRACE_ACTIVE";
	//用户抽奖
	public final static String DOMAIN_USER_DRAW_TRACE_USER="DOMAIN_USER_DRAW_TRACE_USER";
	//黑名单
	public final static String DOMAIN_BLACK_LIST="BLACK_LIST";
	//指定用户
	public final static String DOMAIN_ASSIGNED_WINNER="ASSIGNED_WINNER";
	//中奖名单Top
	public final static String DOMAIN_TOP_WINNER="TOP_WINNER";
	
	//奖品名称空间
	public final static String DOMAIN_AWARD="AWARD";
	

	//抽奖乐观锁
	public final static String DOMAIN_DRAW_LOCK="DOMAIN_DRAW_LOCK";
	
	public final static String DOMAIN_DISK="DISK";
	
	/**
	 * 用户访问 高频日志	ACCESS__LOG_ip
	 */
	public final static String ACCESS__LOG="ACCESS__LOG";
	
	
	//活动列表
//	public final static String ACTIVE__ACTIVE_LIST="ACTIVE__ACTIVE_LIST";
	
	
	/**
	 * 活动ACTIVE__ACTIVE__activeid
	 */
//	public final static String ACTIVE__ACTIVE="ACTIVE__ACTIVE";
	
	/**
	 * 用户在每个活动中的抽奖次数  USER_DRAW_TRACE__USER_ucenterid_activeid
	 */
//	public final static String USER_DRAW_TRACE__USER="USER_DRAW_TRACE__USER";
	
	
	/**
	 * 每个活动总体抽奖次数  USER_DRAW_TRACE__ACTIVE_activeid
	 */
//	public final static String USER_DRAW_TRACE__ACTIVE="USER_DRAW_TRACE__ACTIVE";
	
	/**
	 * 黑名单列表
	 */
//	public final static String BLACK_LIST__LIST="BLACK_LIST__LIST";
	
	/**
	 * 指定用户中奖列表	ASSIGNED_WINNER__LIST
	 */
//	public final static String ASSIGNED_WINNER__LIST="ASSIGNED_WINNER__LIST";
	
	
	/**
	 * 中奖用户top	TOP_WINNER__WINNER_activeid
	 */
//	public final static String TOP_WINNER__WINNER="TOP_WINNER__WINNER";
	
	
//	public static Map<String,Set<String>> NAME_SPACE = new HashMap<String, Set<String>>(); 
//	static{
//		Field[] fields = CacheKeyConstants.class.getFields();
//		for (Field field : fields) {
//			if(field.getName().equalsIgnoreCase("NAME_SPACE"))
//				continue;
//			String name;
//			try {
//				name = field.get(null).toString();
//				Set<String> set = NAME_SPACE.get(name.split("__")[0]);
//				if(set==null){
//					set =new HashSet<String>();
//					NAME_SPACE.put(name.split("__")[0], set);
//				}
//				set.add(name);
//			} catch (Exception e) {
//				e.printStackTrace();
//			} 
//		}
//	}
//	public static void main(String[] args) {
//		System.out.println(CacheKeyConstants.NAME_SPACE);
//	}
}
